﻿<Window x:Class="WMSSoft.WinKStart.ChooseFilterDlg"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ViewModel="clr-namespace:WMSSoft.WinKStart.ViewModel"
        x:Name="KeyChooseFilterDlg"
        Title="{Binding ViewName}" Height="300" Width="470" WindowStartupLocation="CenterOwner"  WindowStyle="ToolWindow">
    <Grid Margin="10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="25"/>
            <RowDefinition/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <Label Grid.Column="0" Grid.Row="0" Content="DataSource:" HorizontalAlignment="Left" Padding="0,0,0,0" Margin="0,2,10,5" VerticalAlignment="Top"/>
        <TextBox Grid.Column="1" TextWrapping="Wrap" Margin="0,0,0,5" Text="{Binding DataSource}" VerticalContentAlignment="Center" IsReadOnly="True"/>
        <Label Grid.Column="0" Grid.Row="1" Content="Current Path:" HorizontalAlignment="Left" Padding="0,0,0,0" Margin="0,2,10,5" VerticalAlignment="Top"/>
        <TextBox Grid.Column="1" Grid.Row="1" TextWrapping="Wrap" Margin="0,0,0,5" Text="{Binding CurrentFilter, Mode=OneWay}" VerticalContentAlignment="Center" IsReadOnly="True"/>
        <TreeView Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" ItemsSource="{Binding RootItem.Items}" SelectedItemChanged="TreeView_SelectedItemChanged">
            <TreeView.ItemContainerStyle>
                <Style TargetType="{x:Type TreeViewItem}">
                    <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />                    
                    <!--<Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="FontWeight" Value="Bold" />
                        </Trigger>
                    </Style.Triggers>-->
                </Style>                
            </TreeView.ItemContainerStyle>
            <TreeView.Resources>
                <HierarchicalDataTemplate DataType="{x:Type ViewModel:SingleStartFolderItemViewModel}"  ItemsSource="{Binding Items}">
                    <StackPanel Orientation="Horizontal">
                        <Image Height="20" Width="20" Source="/WinKStart;component/images/folder.png" Stretch="Fill" />
                        <TextBlock Text="{Binding Header}" />
                    </StackPanel>
                </HierarchicalDataTemplate>
            </TreeView.Resources>
        </TreeView>
        <StackPanel Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Orientation="Horizontal" FlowDirection="RightToLeft">
            <Button  Content="{Binding Cmd_Close.ViewName}" Margin="5,5,0,5" Height="20" Width="100"  Command="{Binding Cmd_Close.Command}" CommandParameter="{Binding ElementName=KeyChooseFilterDlg}"/>
            <Button  Content="{Binding Cmd_Choose.ViewName}" Margin="5,5,0,5" Height="20" Width="100"  Command="{Binding Cmd_Choose.Command}" CommandParameter="{Binding ElementName=KeyChooseFilterDlg}"/>
        </StackPanel>
    </Grid>
</Window>
